home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hobby PC 13
/
Hobby PC 13.iso
/
assets
/
Asset Library
/
Dynamic HTML Utilities
/
Ticker Tape Field
/
tickertape.txt
< prev
Wrap
Text File
|
2001-04-09
|
2KB
|
74 lines
<SCRIPT ID="SQTicker" LANGUAGE="JavaScript">
<!--
function setupTicker(theMessage,fwidth,speed)
{
x = new Date(); formcount = x.getTime();
formName = "scrollForm" + formcount;
fieldName = "scrollField" + formcount;
if ((navigator.userAgent.indexOf("MSIE") == -1) && (navigator.userAgent.indexOf("msie") == -1))
{
fieldStyle = "";
}
else
{
fieldStyle = "Courier";
}
document.write('<FORM name="'+ formName + '"><INPUT NAME="' + fieldName + '" SIZE="' + fwidth + '" STYLE="font-family:' + fieldStyle + '"></FORM>');
eval("scrollText(document." + formName + "." + fieldName + ",theMessage,fwidth,speed,0,0,0)");
}
function scrollText(theField,theMessage,theWidth,theSpeed,scrollStart,scrollEnd,scrollCount)
{
theOtherField = theField;
if (scrollEnd < (theMessage.length))
{
theField.value = padTextPrefix(theMessage.substring(scrollStart,scrollEnd)," ",theWidth-scrollCount);
scrollEnd++;
}
else
{
scrollCount++;
theField.value = padTextSuffix(padTextPrefix(theMessage.substring(scrollStart,scrollEnd)," ",theWidth-scrollCount)," ",theWidth);
}
if (scrollCount == (parseInt(theWidth)-theMessage.substring(scrollStart,scrollEnd).length+1))
{
scrollStart++;
}
if (scrollStart == scrollEnd)
{
scrollStart = 0;
scrollEnd = 0;
scrollCount = 0;
}
scrollTimeout=eval("window.setTimeout('scrollText(theOtherField,\""+theMessage+"\"," + theWidth + "," + theSpeed + "," + scrollStart + "," + scrollEnd + "," + scrollCount + ")',theSpeed)");
}
function padTextPrefix (InString, PadChar, DefLength)
{
if (InString.length>=DefLength)
{
return (InString);
}
OutString = InString;
for (Count = InString.length; Count<DefLength; Count++)
{
OutString=PadChar+OutString
}
return (OutString);
}
function padTextSuffix (InString, PadChar, DefLength)
{
if (InString.length >= DefLength)
{
return (InString);
}
OutString = InString;
for (Count = InString.length; Count<DefLength; Count++)
{
OutString = OutString + PadChar
}
return (OutString);
}
// -->
</SCRIPT>